<?php

namespace common\models\rbac;

use Yii;

/**
 * This is the model class for table "{{%rbac_menu}}".
 *
 * @property int $id 菜单标识
 * @property int $parent_menu_id 父菜单
 * @property int $module_id 模块ID
 * @property string $name 菜单名称
 * @property string $flag 菜单路由
 * @property string $url 菜单链接
 * @property string $class_style 菜单对应的样式
 * @property int $status 状态【-1：删除; 0：禁用; 1：启用】
 * @property int $sort 排序
 * @property int $operation_id 操作人ID【member_id】
 * @property int $created_at 添加时间
 * @property int $updated_at 更新时间
 */
class Menu extends \common\models\base\BaseModel
{
    const STATUS_DELETE = -1;// 删除
    const STATUS_INVALID = 0;// 失效
    const STATUS_ENABLE = 1;// 正常

    public static $statuss = [
        self::STATUS_DELETE => '删除',
        self::STATUS_INVALID => '停用',
        self::STATUS_ENABLE => '启用',
    ];

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%rbac_menu}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['parent_menu_id', 'module_id', 'status', 'sort', 'operation_id', 'created_at', 'updated_at'], 'integer'],
            [['name', 'flag', 'url'], 'string', 'max' => 100],
            [['class_style'], 'string', 'max' => 50],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => '菜单标识',
            'parent_menu_id' => '父菜单',
            'module_id' => '模块ID',
            'name' => '菜单名称',
            'flag' => '菜单路由',
            'url' => '菜单链接',
            'class_style' => '菜单对应的样式',
            'status' => '状态【-1：删除; 0：禁用; 1：启用】',
            'sort' => '排序',
            'operation_id' => '操作人ID【member_id】',
            'created_at' => '添加时间',
            'updated_at' => '更新时间',
        ];
    }
}
